#include <stdlib.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>

int main (int argc, char *argv[]){

	int i = 0, j = 0;
	char * output_name = NULL;
	FILE * file = NULL, *input = NULL;
	char c = 0;
	printf("Cuantos archivos hay para procesar? : %i\n",argc-1);
	
	for(j= 1; j < argc; j++){

        
        output_name = malloc(sizeof(char)*(strlen(argv[j])+5));
        output_name[0] = 'o';
        output_name[1] = 'u';
        output_name[2] = 't';
        output_name[3] = '/';
        for(i = 1; i <= strlen(argv[j])+1;i++){
              output_name[i+3] = argv[j][i-1];
              }

              
       	printf("Procesando %s:\nArchivo de salida: %s\n",argv[j],output_name);        
        
        file = fopen(output_name,"w");
    	input = fopen(argv[j],"r");   	
    	
        getchar();
    	
    	
    	do{
            i++;
    		fread(&c, 1, 1, input);
    		//printf("C: %c\n",c);
    		
    		if(c == '\n')
    			c = '\n';
   			fwrite(&c,sizeof(char),1,file);
    	}while(!feof(input) && i < 100000); 
    	
    	fclose(file);
    	fclose(input);
     }

	return 0;


}







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































